package com.example.Service.impl;

import com.example.Service.HealthRecordService;
import com.example.entity.HealthRecord;
import com.example.mapper.HealthRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HealthRecordServiceImpl implements HealthRecordService {

    @Autowired
    private HealthRecordMapper healthRecordMapper;

    @Override
    public int addHealthRecord(HealthRecord record) {
        return healthRecordMapper.insertHealthRecord(record);
    }

    @Override
    public int deleteHealthRecordById(Integer recordId) {
        return healthRecordMapper.deleteHealthRecordById(recordId);
    }

    @Override
    public int updateHealthRecord(HealthRecord record) {
        return healthRecordMapper.updateHealthRecord(record);
    }

    @Override
    public List<HealthRecord> getHealthRecordsByUserId(Integer userId) {
        return healthRecordMapper.getHealthRecordsByUserId(userId);
    }
}
